<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>吃什么-注册</title>
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
        <%- include ../include/head.ejs %>
        <link rel="stylesheet" href="./stylesheets/mycss.css" >
        <script>
            function loginUser(){
                var userEmail = $("#userEmail").val();
                var userName = $("#userName").val();
                var password = $("#password").val();
                var password1 = $("#password1").val();
                $.ajax({
                    url:"/registe",
                    data:{userEmail:userEmail,userName:userName,password:password,password1:password1},
                    success:function(data){
                        if(data.code === "0"){
                            $.alert(data.desc, function(){
                                window.location.href = "/login";
                            });
                        } else {
                            $.alert(data.desc);
                        }
                    },
                    error:function(){
                        $.alert("注册失败");
                    }

                });
            }

        </script>
    </head>
    <body>
        <div class="container">
            <div class="logo">
                <img src="/images/logo.svg" class="img-responsive">
            </div>
            <from>
                <div class="form-group">
                    <label for="userName">email</label>
                    <input type="email" class="form-control" id="userEmail" name="userEmail" placeholder="email">
                </div>
                <div class="form-group">
                    <label for="userName">用户名</label>
                    <input type="text" class="form-control" id="userName" name="userName" placeholder="用户名">
                </div>
                <div class="form-group">
                    <label for="password">密码</label>
                    <input type="password" class="form-control" id="password" name="password" placeholder="密码">
                </div>
                <div class="form-group">
                    <label for="password">密码</label>
                    <input type="password" class="form-control" id="password1" name="password1" placeholder="密码">
                </div>
                <a href="javascript:;" class="weui-btn weui-btn_primary" onclick="loginUser()">注册</a>
                <a href="/login" class="weui-btn weui-btn_default">取消</a>
            </from>
        </div>
        <% include ../include/head-js.ejs %>
    </body>
</html>